import styles from './index.less';
let Hls = require('hls.js');
import DPlayer from 'dplayer';
import { useEffect, useState, useRef } from 'react';

export default function VideoM3u8(props: any) {
  const { info } = props;
  const refEle = useRef(null);
  useEffect(() => {
    const dp = new DPlayer({
      live: true,
      autoplay: true,
      container: refEle.current,
      video: {
        url: 'http://60.163.198.70:10800/hls/stream_1/live.m3u8', // 地址
        type: 'customHls',
        customType: {
          customHls: function (video: any, player: unknown) {
            const hls = new Hls();
            hls.loadSource(video.src);
            hls.attachMedia(video);
          },
        },
      },
    });
  });
  return <div className={styles.videoC} ref={refEle}></div>;
}
